/*************************************************************************
 *
 * $Id: menu_def.h 66 2006-07-30 14:24:48Z alpov $
 * 
 *************************************************************************/         

typedef struct PROGMEM
{
    unsigned char state;
    unsigned char key;
    unsigned char nextstate;
    unsigned char (*pStateFunc)(unsigned char key, unsigned char state);
} MENU_NEXTSTATE;

const MENU_NEXTSTATE menu_nextstate[] PROGMEM = {
    /*  STATE               KEY                     NEXT_STATE      STATE_FUNC             */
    {   ST_MAIN,            KEY_FN,                 ST_SHIFT,       0                       },
    {   ST_MAIN,            KEY_PLUS | KEY_MINUS | KEY_SET, 0,      MenuChangeMain          },

    {   ST_SHIFT,           KEY_FN,                 ST_MODE,        0                       },
    {   ST_SHIFT,           KEY_SET,                0,              MenuEditShift           },
    {   ST_SHIFT_EDIT,      KEY_FN | KEY_SET,       0,              MenuEditShift           },
    {   ST_SHIFT_EDIT,      KEY_PLUS | KEY_MINUS,   0,              MenuChangeValue         },

    {   ST_MODE,            KEY_FN,                 ST_RTC,         0                       },
    {   ST_MODE,            KEY_SET,                0,              MenuEditMode            },
    {   ST_MODE_EDIT,       KEY_FN | KEY_SET,       0,              MenuEditMode            },
    {   ST_MODE_EDIT,       KEY_PLUS | KEY_MINUS,   0,              MenuChangeValue         },

    {   ST_RTC,             KEY_FN,                 ST_SWITCH,      0                       },
    {   ST_RTC,             KEY_SET,                0,              MenuEditRtc             },
    {   ST_RTC_EDIT,        KEY_FN | KEY_SET,       0,              MenuEditRtc             },
    {   ST_RTC_EDIT,        KEY_PLUS | KEY_MINUS,   0,              MenuChangeClock         },

    {   ST_SWITCH,          KEY_FN,                 ST_CONFIG,      0                       },
    {   ST_SWITCH,          KEY_SET,                0,              MenuEditSwitch          },
    {   ST_SWITCH_EDIT_M,   KEY_FN | KEY_SET,       0,              MenuEditSwitch          },
    {   ST_SWITCH_EDIT_M,   KEY_PLUS | KEY_MINUS,   0,              MenuChangeValue         },
    {   ST_SWITCH_EDIT_C,   KEY_FN | KEY_SET,       0,              MenuEditSwitch          },
    {   ST_SWITCH_EDIT_C,   KEY_PLUS | KEY_MINUS,   0,              MenuChangeClock         },
                                                                                         
    {   ST_CONFIG,          KEY_FN,                 ST_MAIN,        0                       },
    {   ST_CONFIG,          KEY_SET,                0,              MenuEditConfig          },
    {   ST_CONFIG_EDIT,     KEY_FN | KEY_SET,       0,              MenuEditConfig          },
    {   ST_CONFIG_EDIT,     KEY_PLUS | KEY_MINUS,   0,              MenuChangeValue         },

    {   ST_MESSAGE,         KEY_FN | KEY_SET,       ST_MAIN,        0                       },

    {   0,                  0,                      0,              0                       }
};
